#include "stdafx.h"

#include "MsgBody.h"

#define PARSER_ROLLBACK		2
#define PARSER_BUFFER_SIZE	16 + PARSER_ROLLBACK
#define MAX_SMS_BUFFER_SIZE 512

#define INBOX_SMS_UDSP_SIZE 3
#define INBOX_SMS_PB_SIZE	4
//	MIN_INBOX_PACKET_LENGTH		38
//	MIN_OUTBOX_PACKET_LENGTH	49
//	MIN_SENT_PACKET_LENGTH		46
//	MIN_SAVE_PACKET_LENGTH		36
//	MIN_DRAFT_PACKET_LENGTH		25

errno_t	msgvolparser_getlasterr (void);
int	msgvolparser_init(const char *strVolFile);
void msgvolparser_deinit(void);
int msgvolparser_locate_next_SMS_Header (void);
int msgvolparser_analyse_sms_packet (s_SMS_t *pSMS);
int msgvolparser_readas_type1 (s_SMS_t *pSMS);
int msgvolparser_readas_type23 (s_SMS_t *pSMS);
int msgvolparser_readas_type5 (s_SMS_t *pSMS);
int msgvolparser_readas_type4 (s_SMS_t *pSMS);
int msgvolparser_read_vardata (BYTE *pBuf, size_t sizeof_pBuf, int lBytes=1);
void msgvolparser_skip_bytes (int iBytes);
int msgvolparser_preread_fixdata (BYTE *pBuf, size_t iBytes, int rollback=1);
int	msgvolparser_checkbytes (const BYTE *pCB, size_t sizeof_pCB);
void msgvolparser_print_read_results (void);
int msgvolparser_locate_next_Header (const BYTE *pCB, size_t sizeof_pCB);